import { useEffect } from 'react';
import { connect } from 'dva';
import { Table } from 'antd';
import './StatusPage.css';

const GroupStatusPage = ({ dispatch, statusGroupList, group }) => {

  useEffect(() => {
    dispatch({
      type: 'status/getStatusGroupList',
      payload: { group },
    });
  })

  const columns = [{
    title: '姓名',
    dataIndex: 'username'
  },{
    title: '状态',
    dataIndex: 'status',
  }];
  return (
    <div>
        <Table
          dataSource={statusGroupList}
          columns={columns}
        />
    </div>
  );
};

export default connect(state => {
  const { username, group } = state.users;
  const { statusGroupList } = state.status;
  return {
    username,
    group,
    statusGroupList
  }
})(GroupStatusPage);
